package auth_model

import (
	"time"
)

// Permission 权限模型
type Permission struct {
	ID          int64     `gorm:"primaryKey;autoIncrement" json:"id"`
	Name        string    `gorm:"type:varchar(64);not null" json:"name"`
	Code        string    `gorm:"type:varchar(64);uniqueIndex;not null" json:"code"`
	Type        int8      `gorm:"type:tinyint(1);default:1" json:"type"` // 1=菜单权限 2=按钮权限
	Method      string    `gorm:"type:varchar(10)" json:"method"`
	Path        string    `gorm:"type:varchar(255)" json:"path"`
	Description string    `gorm:"type:varchar(255)" json:"description"`
	CreatedAt   time.Time `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt   time.Time `gorm:"autoUpdateTime" json:"updated_at"`
}

// TableName 指定权限表名
func (Permission) TableName() string {
	return "permissions"
}
